package mian.java.concurrency.thread.synchronizedExample;

import org.openjdk.jol.info.ClassLayout;

/**
 * 重量级锁
 */
public class HeightLock {

    public static void main(String[] args) {
        HeightLock heightLock = new HeightLock();
        Thread t1 = new Thread(()->{
            synchronized (heightLock){
                System.out.println("t1 lock ing");
                System.out.println(ClassLayout.parseInstance(heightLock).toPrintable());
            }
        });
        t1.start();

        synchronized (heightLock){
            System.out.println("main lock ing");
            System.out.println(ClassLayout.parseInstance(heightLock).toPrintable());
        }
    }

}
